﻿using Hazza.eLearning.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;


namespace Hazza.eLearning.Drivers
{
    public class HazzaExamPartDriver : ContentPartDriver<HazzaExamPart>
    {
        protected override string Prefix
        {
            get { return "HazzaExamPart"; }
        }

        protected override DriverResult Display(HazzaExamPart part, string displayType, dynamic shapeHelper)
        {
            return ContentShape("Parts_HazzaExamPart",
                () => shapeHelper.Parts_HazzaExamPart(
                    Model: part));
        }

        protected override DriverResult Editor(HazzaExamPart part, dynamic shapeHelper)
        {
            return ContentShape("Parts_HazzaExamPart_Edit",
                () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/HazzaExamPart",
                    Model: part,
                    Prefix: Prefix));
        }

        protected override DriverResult Editor(HazzaExamPart part, IUpdateModel updater, dynamic shapeHelper)
        {
            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);
        }
    }
}